<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>点一下变颜色</title>
    <style>
        input{
            
        }
    </style>
</head>
<body>
    <form action="">
        <input type="button" value="点我试试看" id="an">
    </form>
    <script>
        var an=document.getElementById('an');
       an.onclick=function(){ an.style.background="red";}
    </script>
</body>
</html>